/* "Producto" */
class HotDog {
  private String pan = "";
  private String salsa = "";
  private String salchicha = "";

  public void setpan(String pan){
	  this.pan = pan; 
	  }
  
  
  public void setsalsa(String salsa)     {
	  this.salsa = salsa; 
	  }
  
  public void setsalchicha(String salchicha) { 
	  this.salchicha = salchicha; 
	  }
}


/* "Abstract Builder" */
abstract class HotDogBuilder {
	
  protected HotDog HotDog;

  public HotDog getHotDog() { 
	  return HotDog; 
	  
  }
  
  
  public void HacerNuevoHotDog() {
	  HotDog = new HotDog(); 
	  
  }

  public abstract void buildpan();
  public abstract void buildsalsa();
  public abstract void buildsalchicha();




/* "ConcreteBuilder" */
class HotDogBuilderRanchero extends HotDogBuilder {
	
  public void buildpan()   {
	  HotDog.setpan("blanco");
	  
  }
  public void buildsalsa()   {
	  HotDog.setsalsa("picante"); 
	  }
  public void buildsalchicha() {
	  HotDog.setsalchicha("zenu ranchera"); }
}

/* "ConcreteBuilder" */
class PolloHotDogBuilder extends HotDogBuilder {
  public void buildpan()   { 
	  
	  HotDog.setpan("tostado");
	  }
  
  public void buildsalsa()   {
	  
	  HotDog.setsalsa("mostaza"); 
	  }
  
  public void buildsalchicha() {
	  
	  HotDog.setsalchicha("salchicha de pollo"); 
	  }
}

/* "Director" */
class Cocina {
  private HotDogBuilder HotDogBuilder;

  public void setHotDogBuilder(HotDogBuilder pb) {
	  
	  HotDogBuilder = pb;
	  
  }
  public HotDog getHotDog() {
	  
	  return HotDogBuilder.getHotDog(); 
  
  }

  public void constructHotDog() {
    HotDogBuilder.HacerNuevoHotDog();
    HotDogBuilder.buildpan();
    HotDogBuilder.buildsalsa();
    HotDogBuilder.buildsalchicha();
  }
}

/*ejemplo builder. */
class BuilderEjemplo {
  public void main(String[] args) {
    Cocina cocinar = new Cocina();
    HotDogBuilder HotDog_Ranchero = new HotDogBuilderRanchero();
    HotDogBuilder HotDog_Pollo = new PolloHotDogBuilder();

    cocinar.setHotDogBuilder( HotDog_Ranchero );
    cocinar.constructHotDog();

    HotDog HotDog = cocinar.getHotDog();
  }
  
}
}